package com.atguigu.gulimall.order.service;

import com.atguigu.common.to.mq.SeckillOrderTo;
import com.atguigu.gulimall.order.vo.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.order.entity.OrderEntity;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author hukeyang
 * @email 2360481976@qq.com
 * @date 2021-08-18 20:14:42
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认页返回需要的数据
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 提交订单
     */
    SubmitOrderResponseVo submitOrder(OrderSubmitVo vo);

    /**
     * 获取订单
     */
    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭订单
     */
    void closeOrder(OrderEntity entity);

    /**
     * 获取支付数据
     * @param orderSn 订单编号
     * @return 支付数据vo
     */
    PayVo getOrderPay(String orderSn);

    /**
     * 查询订单
     */
    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 支付宝支付成功后的处理
     */
    String handleResult(PayAsyncVo vo);

    /**
     * 监听秒杀订单消息
     * @param seckillOrder 秒杀订单
     */
    void createSeckillOrder(SeckillOrderTo seckillOrder);
}

